package com.ship.contract.utils;


import com.ship.contract.service.*;

import java.util.HashMap;
import java.util.Map;

/**
 * @author tangshixuan
 * @date 2023-9-7
 */
public class ModuleConst {
    public final static String CON_RESOURCE_MAIN = "con_resource_main";

    public final static String CON_RESOURCE_MEMORANDUM = "con_resource_memorandum";

    public final static String CON_INSURANCE_GOODS = "con_insurance_goods";

    public final static String CON_INSURANCE_PEOPLE = "con_insurance_people";

    public final static String CON_LAWYER = "con_lawyer";

    public final static String CON_SHIPPING = "con_shipping";

    public final static String CON_SHIPPING_AGENCY = "con_shipping_agency";

    public final static String CON_REFUELING = "con_refueling";

    public final static String TEMPLATE_FILE = "template_file";

    public final static String CON_THIRD_PARTY_MEASUREMENT = "con_third_party_measurement";

    public final static String CON_BROKER = "con_broker";


    private static final Map<Integer, Class<?>> MAP = new HashMap<>(16);

    static {
        MAP.put(1, ConResourceMainService.class);
        MAP.put(2, ConShippingService.class);
        MAP.put(3, ConShippingAgencyService.class);
        MAP.put(4, ConThirdPartyMeasurementService.class);
        MAP.put(5, ConInsuranceGoodsService.class);
        MAP.put(6, ConRefuelingService.class);
        MAP.put(7, ConLawyerService.class);
        MAP.put(8, ConResourceMemorandumService.class);
        MAP.put(9, ConInsurancePeopleService.class);
        MAP.put(10, ConBrokerService.class);
    }

    private ModuleConst() {
    }

    public static Class<?> getContractBaseBean(Integer module) {
        if (MAP.containsKey(module)) {
            return MAP.get(module);
        }
        for (Map.Entry<Integer, Class<?>> entry : MAP.entrySet()) {
            int key = entry.getKey();
            if (module.equals(key)) {
                return MAP.get(key);
            }
        }
        return null;
    }

}
